/**
 * 
 */
package com.yinhai.activity;

import android.support.v4.app.Fragment;

/**
 * @author Juyon
 * 
 */
public class FragmentFactory {

	private final static FragmentFactory fragmentFactory = new FragmentFactory();

	private Fragment dialFragment = null;

	private Fragment msgFragment = null;

	private Fragment contactFragment = null;

	private Fragment appFragment = null;

	private Fragment moreFragment = null;

	private Fragment msgFragmentnew = null;

	private FragmentFactory() {

		dialFragment = new DialFragment();

		msgFragment = new MsgFragment();

		// contactFragment = new ContactNewFragment();
		contactFragment = new ContactGroupFragment();

		appFragment = new AppFragment();

		moreFragment = new MoreAppFragment();

		msgFragmentnew = new MsgFragmentnew();
	}

	public static FragmentFactory getInstance() {
		return fragmentFactory;
	}

	public Fragment getInstanceById(int index) {
		Fragment fragment = null;
		switch (index) {
		case R.id.radio_dial:
			fragment = this.dialFragment;
			break;
		case R.id.radio_msg:
			fragment = this.msgFragmentnew;
			break;
		case R.id.radio_contact:
			fragment = this.contactFragment;
			break;
		case R.id.radio_app:
			fragment = this.appFragment;
			break;
		case R.id.radio_more:
			fragment = this.moreFragment;
			break;
		case 6:
			fragment = this.msgFragment;
			break;
		}
		return fragment;
	}
}
